package per.hx.bs.topic.receiver;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import per.hx.bs.base.entity.EmailVO;
import per.hx.bs.constant.TopicRabbit;
import per.hx.bs.service.IEmailService;

/**
 * @author HuXing
 * @date 2018/4/26  12:30
 */
@Component
public class TopicEmailReceiver {

    private final
    IEmailService emailService;

    @Autowired
    public TopicEmailReceiver(IEmailService emailService) {
        this.emailService = emailService;
    }

    @RabbitListener(queues = TopicRabbit.EMAIL)
    @RabbitHandler
    public void process(EmailVO emailVO) {
        Logger logger = LoggerFactory.getLogger(getClass());
        logger.info(emailVO.toString());
        //emailService.send(emailVO);
    }
}
